< previous page page_439 next page >

Page 439
Type.gifListing 11.24. Coding the AddLegends method.
Private Sub AddLegends()
    '
    ' add legends to the existing graph
    '
    If Trim(strLegendField) = "" Then Exit Sub
    '
    frmGraph.Graph1.AutoInc = 1
    '
    rs.MoveFirst
    For lngLoop = 1 To lngNumPoints
        frmGraph.Graph1.LegendText = rs.Fields(strLegendField)
        rs.MoveNext
    Next
    '
End Sub
Notice the first line of code in Listing 11.24. The line checks to see whether the strLegendField variable contains any printable data. If not, the Exit Sub is executed. No reason to set the legends if no LegendField has been set!
Now add the Private Sub called AddLabels to your class. The code in Listing 11.25 should be added to this new method.
Type.gifListing 11.25. Coding the AddLabels method.
Private Sub AddLabels()
    '
    ' add labels to the existing graph
    '
    If Trim(strLabelField) = "" Then Exit Sub
    '
    frmGraph.Graph1.AutoInc = 1
    '
    rs.MoveFirst
    For lngLoop = 1 To lngNumPoints
        frmGraph.Graph1.LabelText = rs.Fields(strLabelField)
        rs.MoveNext
    Next
    '
End Sub
Next, you need to add the Private Sub called AddTitles to the class. This sets the left and bottom title properties of the graph. Listing 11.26 contains the code needed for this method. Note that the variables strLeftTitle and strBottomTitle are checked for valid data before the graph properties are actually set.

 
< previous page page_439 next page >

If you like this book, buy it!